package llama.util;

import java.awt.Color;

/**
 * A helper class to convert colors to hexadecimal representation.
 */
public class ColorHelper {
	/**
	 * Gets the hex-representation of the provided color.<br>
	 * The returned String is cropped to only contain the 6-digit hex-code.   
	 * @param color - The Color to be represented in hex-format and converted to a String.
	 * @return provided color in hex-format as a String.
	 */
	public static String colorToHex(Color color) {
		String hex = Integer.toHexString(color.getRGB());
		hex = hex.substring(2, hex.length()); //Remove "0x"
		return hex;
	}
}
